﻿@model QuanLyGiaoVuUI.Models.SinhVien.BangDiemChuongTrinhKhungViewModel
@{
    ViewBag.Title = "BangDiem";
    Layout = "~/Views/Shared/_LayoutSinhVienClient2.cshtml";
}

<style>
    td.diemkhongdat {
        color:red;
    }
</style>

<div style="margin: 20px auto;">
    <center><h1 style="font-size:33px;"><strong>BẢNG ĐIỂM SINH VIÊN</strong></h1></center>
</div>
<div>
    @{Html.RenderAction("ThongTinCaNhanBangDiem", "SinhVien");}
</div>
<div>
    <table class="gridtable" cellspacing="0" border="1" bordercolor="#000000" width="100%">
        <tbody>
            <tr>
                <th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
                <th>&nbsp;Mã HP</th>
                <th>&nbsp;Tên học phần</th>
                <th>&nbsp;Tín chỉ</th>
                <th>&nbsp;Điểm số</th>
                <th>&nbsp;Ghi chú</th>
            </tr>
            @if (Model.DanhSachMonHoc != null)
            {                
                if (Model.listBangDiem != null)
                {

                    var j=0;
                    foreach (var monhoc in Model.DanhSachMonHoc)
                    {
                        var isDiemMonHoc = false;
                        j++;                                 
                         <tr >
                            <td align="center">@j</td>
                            <td align="center">@monhoc.MaMonHoc</td>
                            <td>&nbsp;@monhoc.TenMonHoc</td>
                            <td align="center">@monhoc.TongSoTinChi</td>                                                                                
                            @foreach (var diemmonhoc in Model.listBangDiem)
                            {
                                if (diemmonhoc.MaMonHoc == monhoc.ID)
                                {                          
                                    isDiemMonHoc=true;
                                    if(diemmonhoc.DiemHocPhan/100>=5)
                                    {      
                                     <td align="center">@(diemmonhoc.DiemHocPhan/100)</td>                                   
                                    }
                                    else{
                                        <td class="diemkhongdat" align="center">@(diemmonhoc.DiemHocPhan/100)</td>  
                                    }
                                    break;
                                }              
                                else{
                                    isDiemMonHoc = false;
                                }                                                  
                            }        
                            @if(!isDiemMonHoc){
                                <td>&nbsp;</td>
                            }                                                                                               
                            <td>&nbsp;</td>
                            </tr> 
                        
                    }
                    
                    
                }
                /*
                int i = 0;
                foreach (var diem in Model.listBangDiem)
                {
                    i++;
                if (diem.DiemHocPhan < 5)
                { 
                <tr class="diemkhongdat">
                    <td align="center">@i</td>
                    <td align="center">@diem.MonHoc.MaMonHoc</td>
                    <td>&nbsp;@diem.MonHoc.TenMonHoc</td>
                    <td align="center">@diem.MonHoc.TongSoTinChi</td>
                    <td align="center">@diem.DiemHocPhan</td>
                    <td>&nbsp;</td>
                </tr>
                }
                else{
                <tr>
                    <td align="center">@i</td>
                    <td align="center">@diem.MonHoc.MaMonHoc</td>
                    <td>&nbsp;@diem.MonHoc.TenMonHoc</td>
                    <td align="center">@diem.MonHoc.TongSoTinChi</td>
                    <td align="center">@diem.DiemHocPhan</td>
                    <td>&nbsp;</td>
                </tr>
                }
                }
                */
            }
        </tbody>
    </table>
</div>

